<template>
  <div>
    <h1>展示</h1>
    欢迎{{ user.name }}
    {{ user.cla.name }}
    <p v-for="i in user.cla.banji">{{ i.name }}</p>
    <button @click="shengji" v-if="user.cla.types<=2">升级</button>
  </div>
</template>

<script>
export default {
  name: "show_xpy",
  data() {
    return {
      userid: localStorage.getItem('userid'),
      user: {}
    }
  },
  methods: {
    get_user() {
      this.$axios.get('users/banji/?userid=' + this.userid)
        .then(res => {
          if (res.data.code == 200) {
            this.user = res.data.list
          }
        })
    },
    shengji() {
      this.$axios.put('users/banji/?userid=' + this.userid)
        .then(res => {
          if (res.data.code == 200) {
            alert('升级成功')
            this.get_user()

          }
        })
    }
  },
  mounted() {
    this.get_user()
  }

}
</script>

<style scoped>

</style>
